package com.wqtz.chechai.adapter;

import android.view.View;
import android.widget.ListView;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.lvbaseadapter.LvBaseAdapter;
import com.wqtz.chechai.base.lvbaseadapter.ViewHolder;
import com.wqtz.chechai.bean.SeriesBean;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/29 10:12
 */

public class CarSeriesSecondAdapter extends LvBaseAdapter<SeriesBean.ResultBean.PinpaiListBean.XilieBean>{
	public CarSeriesSecondAdapter(int resId) {
		super(resId);
	}

	@Override
	public void bindDatas(final List<SeriesBean.ResultBean.PinpaiListBean.XilieBean> list, final int position, ViewHolder holder) {
       holder.setText(R.id.content,list.get(position).getXlname());
		//防止数组越界
		if(list.size()>position){
			holder.getViewHolder().setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					mClick.secondClick(position,list);
				}
			});
		}
	}

	private secondOnClickCallBack mClick;
	//提供回调方法
	public void setSecondClick(secondOnClickCallBack click){
		mClick=click;
	}
	interface secondOnClickCallBack{
		void secondClick(int position,List<SeriesBean.ResultBean.PinpaiListBean.XilieBean> list);
	}
}
